{{>licenseInfo}}

package {{package}};

import {{invokerPackage}}.ApiCallback;
import {{invokerPackage}}.ApiClient;
import {{invokerPackage}}.ApiException;
{{#dynamicOperations}}
import {{invokerPackage}}.ApiOperation;
{{/dynamicOperations}}
import {{invokerPackage}}.ApiResponse;
import {{invokerPackage}}.Configuration;
import {{invokerPackage}}.Pair;
import {{invokerPackage}}.ProgressRequestBody;
import {{invokerPackage}}.ProgressResponseBody;
{{#performBeanValidation}}
import {{invokerPackage}}.BeanValidationException;
{{/performBeanValidation}}

import com.google.gson.reflect.TypeToken;
{{#dynamicOperations}}
import io.swagger.v3.oas.models.Operation;
import io.swagger.v3.oas.models.parameters.Parameter;
{{/dynamicOperations}}

import java.io.IOException;

{{#useBeanValidation}}
import javax.validation.constraints.*;
{{/useBeanValidation}}
{{#performBeanValidation}}
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.ValidatorFactory;
import javax.validation.executable.ExecutableValidator;
import java.util.Set;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
{{/performBeanValidation}}

{{#imports}}import {{import}};
{{/imports}}

import java.lang.reflect.Type;
{{^fullJavaUtil}}
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
{{#supportStreaming}}
import java.io.InputStream;
{{/supportStreaming}}
{{/fullJavaUtil}}
import javax.ws.rs.core.GenericType;

{{#operations}}
public class {{classname}}Generated {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public {{classname}}Generated() throws IllegalArgumentException {
        this(Configuration.getDefaultApiClient());
    }

    public {{classname}}Generated(ApiClient apiClient) throws IllegalArgumentException {
{{#apiKeyMethods}}
{{#vendorExtensions.x-konfig-globally-required-security}}
        if (apiClient.get{{nameInCamelCase}}() == null) {
            throw new IllegalArgumentException("\"{{keyParamName}}\" is required but no API key was provided. Please set \"{{keyParamName}}\" with ApiClient#set{{nameInCamelCase}}(String).");
        }
{{/vendorExtensions.x-konfig-globally-required-security}}
{{/apiKeyMethods}}
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.localVarApiClient = apiClient;
    }

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    {{#operation}}
    {{^vendorExtensions.x-group-parameters}}/**
     * Build call for {{operationId}}{{#allParams}}
     * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}
     * @param _callback Callback for upload/download progress
     * @return Call to execute
     * @throws ApiException If fail to serialize the request body object
     {{#responses.0}}
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        {{#responses}}
        <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
        {{/responses}}
     </table>
     {{/responses.0}}
     {{#isDeprecated}}
     * @deprecated
     {{/isDeprecated}}
        {{#externalDocs}}
     * {{description}}
     * @see <a href="{{url}}">{{summary}} Documentation</a>
        {{/externalDocs}}
     */
    {{#isDeprecated}}
    @Deprecated
    {{/isDeprecated}}
    public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] { {{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}} };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};

        // create path and map variables
        {{^dynamicOperations}}
        String localVarPath = "{{{path}}}"{{#pathParams}}
            .replace("{" + "{{baseName}}" + "}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}};
        {{/dynamicOperations}}
        {{#dynamicOperations}}
        ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("{{{operationId}}}");
        if (apiOperation == null) {
            throw new ApiException("Operation not found in OAS");
        }
        Operation operation = apiOperation.getOperation();
        String localVarPath = apiOperation.getPath();
        Map<String, Object> paramMap = new HashMap<>();
        {{#allParams}}
            {{^isFormParam}}
            {{^isBodyParam}}
        paramMap.put("{{baseName}}", {{paramName}});
            {{/isBodyParam}}
            {{/isFormParam}}
        {{/allParams}}
        {{/dynamicOperations}}

        {{javaUtilPrefix}}List<Pair> localVarQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>();
        {{javaUtilPrefix}}List<Pair> localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList<Pair>();
        {{javaUtilPrefix}}Map<String, String> localVarHeaderParams = new {{javaUtilPrefix}}HashMap<String, String>();
        {{javaUtilPrefix}}Map<String, String> localVarCookieParams = new {{javaUtilPrefix}}HashMap<String, String>();
        {{javaUtilPrefix}}Map<String, Object> localVarFormParams = new {{javaUtilPrefix}}HashMap<String, Object>();

        {{#formParams}}
        if ({{paramName}} != null) {
            localVarFormParams.put("{{baseName}}", {{paramName}});
        }

        {{/formParams}}
        {{^dynamicOperations}}
        {{#queryParams}}
        if ({{paramName}} != null) {
            {{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));
        }

        {{/queryParams}}
        {{#headerParams}}
        if ({{paramName}} != null) {
            localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}}));
        }

        {{/headerParams}}
        {{#cookieParams}}
        if ({{paramName}} != null) {
            localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}}));
        }

        {{/cookieParams}}
        {{/dynamicOperations}}
        {{#dynamicOperations}}
        localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams);

        {{/dynamicOperations}}
        final String[] localVarAccepts = {
            {{#produces}}
            "{{{mediaType}}}"{{^-last}},{{/-last}}
            {{/produces}}
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
            {{#consumes}}
            "{{{mediaType}}}"{{^-last}},{{/-last}}
            {{/consumes}}
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} };
        return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    {{#isDeprecated}}
    @Deprecated
    {{/isDeprecated}}
    @SuppressWarnings("rawtypes")
    private okhttp3.Call {{operationId}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException {
        {{^performBeanValidation}}
        {{#allParams}}
        {{#required}}
        // verify the required parameter '{{paramName}}' is set
        if ({{paramName}} == null) {
            throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{operationId}}(Async)");
        }

        {{/required}}
        {{/allParams}}
        return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback);

        {{/performBeanValidation}}
        {{#performBeanValidation}}
        try {
            ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
            ExecutableValidator executableValidator = factory.getValidator().forExecutables();

            Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} };
            Method method = this.getClass().getMethod("{{operationId}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}});
            Set<ConstraintViolation<{{classname}}>> violations = executableValidator.validateParameters(this, method,
                    parameterValues);

            if (violations.size() == 0) {
                return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback);
            } else {
                throw new BeanValidationException((Set) violations);
            }
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
            throw new ApiException(e.getMessage());
        } catch (SecurityException e) {
            e.printStackTrace();
            throw new ApiException(e.getMessage());
        }
        {{/performBeanValidation}}
    }

    {{^vendorExtensions.x-group-parameters}}
    /**
     * {{summary}}
     * {{notes}}{{#allParams}}
     * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}}
     * @return {{.}}{{/returnType}}
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     {{#responses.0}}
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        {{#responses}}
        <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
        {{/responses}}
     </table>
     {{/responses.0}}
     {{#isDeprecated}}
     * @deprecated
     {{/isDeprecated}}
        {{#externalDocs}}
     * {{description}}
     * @see <a href="{{url}}">{{summary}} Documentation</a>
        {{/externalDocs}}
     */
    {{#isDeprecated}}
    @Deprecated
    {{/isDeprecated}}
    {{#vendorExtensions.x-streaming}}
    public {{#returnType}}InputStream {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
        {{#returnType}}InputStream localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
        return localVarResp;{{/returnType}}
    }
    {{/vendorExtensions.x-streaming}}
    {{^vendorExtensions.x-streaming}}
    public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
        {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
        return localVarResp.getResponseBody();{{/returnType}}
    }
    {{/vendorExtensions.x-streaming}}
    {{/vendorExtensions.x-group-parameters}}

    {{^vendorExtensions.x-group-parameters}}/**
     * {{summary}}
     * {{notes}}{{#allParams}}
     * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}
     * @return ApiResponse&lt;{{returnType}}{{^returnType}}Void{{/returnType}}&gt;
     * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
     {{#responses.0}}
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        {{#responses}}
        <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
        {{/responses}}
     </table>
     {{/responses.0}}
     {{#isDeprecated}}
     * @deprecated
     {{/isDeprecated}}
        {{#externalDocs}}
     * {{description}}
     * @see <a href="{{url}}">{{summary}} Documentation</a>
        {{/externalDocs}}
     */
    {{#isDeprecated}}
    @Deprecated
    {{/isDeprecated}}
    public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
        okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null);
        {{#returnType}}
        {{#errorObjectType}}
        try {
            Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
            return localVarApiClient.executeStream(localVarCall, localVarReturnType);
        } catch (ApiException e) {
            e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType()));
            throw e;
        }
        {{/errorObjectType}}
        {{^errorObjectType}}
        Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
        return localVarApiClient.executeStream(localVarCall, localVarReturnType);
        {{/errorObjectType}}
        {{/returnType}}
    }
    {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{operationId}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException {
        okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null);
        {{^returnType}}
        return localVarApiClient.execute(localVarCall);
        {{/returnType}}
        {{#returnType}}
        {{#errorObjectType}}
        try {
            Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
            return localVarApiClient.execute(localVarCall, localVarReturnType);
        } catch (ApiException e) {
            e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType()));
            throw e;
        }
        {{/errorObjectType}}
        {{^errorObjectType}}
        Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
        {{/errorObjectType}}
        {{/returnType}}
    }
    {{/vendorExtensions.x-streaming}}

    {{^vendorExtensions.x-group-parameters}}/**
     * {{summary}} (asynchronously)
     * {{notes}}{{#allParams}}
     * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}
     * @param _callback The callback to be executed when the API call finishes
     * @return The request call
     * @throws ApiException If fail to process the API call, e.g. serializing the request body object
     {{#responses.0}}
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        {{#responses}}
        <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
        {{/responses}}
     </table>
     {{/responses.0}}
     {{#isDeprecated}}
     * @deprecated
     {{/isDeprecated}}
        {{#externalDocs}}
     * {{description}}
     * @see <a href="{{url}}">{{summary}} Documentation</a>
        {{/externalDocs}}
     */
    {{#isDeprecated}}
    @Deprecated
    {{/isDeprecated}}
    public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{operationId}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException {

        okhttp3.Call localVarCall = {{operationId}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback);
        {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}}
        return localVarCall;
    }
    {{#vendorExtensions.x-group-parameters}}

    public abstract class {{> request_builder_name_partial}}Generated {
        {{#requiredParamsWithRequestBodyProperties}}
        final {{> data_type_partial}} {{paramName}};
        {{/requiredParamsWithRequestBodyProperties}}
        {{#optionalParamsWithRequestBodyProperties}}
        {{> data_type_partial}} {{paramName}};
        {{/optionalParamsWithRequestBodyProperties}}
        {{#bodyParam}}
        {{^isStrictlyObject}}
        {{{dataType}}} {{paramName}};
        {{/isStrictlyObject}}
        {{/bodyParam}}

        public {{> request_builder_name_partial}}Generated({{#requiredParamsWithRequestBodyProperties}}{{#isNumber}}{{{dataTypeLowerCase}}}{{/isNumber}}{{^isNumber}}{{{dataType}}}{{/isNumber}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParamsWithRequestBodyProperties}}) {
            {{#requiredParamsWithRequestBodyProperties}}
            this.{{paramName}} = {{paramName}};
            {{/requiredParamsWithRequestBodyProperties}}
        }

        {{#bodyParam}}
        {{^isStrictlyObject}}
        /**
         * Set {{paramName}}
         * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}})
         * @return {{classname}}.{{> request_builder_name_partial}}
         */
        public {{classname}}.{{> request_builder_name_partial}} {{paramName}}({{{dataType}}} {{paramName}}) {
            this.{{paramName}} = {{paramName}};
            return ({{classname}}.{{>request_builder_name_partial}}) this;
        }

        {{/isStrictlyObject}}
        {{/bodyParam}}
        {{#optionalParamsWithRequestBodyProperties}}
        /**
         * Set {{paramName}}
         * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}})
         * @return {{classname}}.{{> request_builder_name_partial}}
         */
        public {{classname}}.{{> request_builder_name_partial}} {{paramName}}({{> data_type_partial}} {{paramName}}) {
            this.{{paramName}} = {{paramName}};
            return ({{classname}}.{{>request_builder_name_partial}}) this;
        }
        {{#isNumber}}{{#isNullable}}

        /**
         * Set {{paramName}}
         * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}})
         * @return {{classname}}.{{> request_builder_name_partial}}
         */
        public {{classname}}.{{> request_builder_name_partial}} {{paramName}}(Integer {{paramName}}) {
            {{^isNullable}}
            if ({{paramName}} == null) throw new IllegalArgumentException("\"{{paramName}}\" is required but got null");
            {{/isNullable}}
            this.{{paramName}} = {{paramName}}.doubleValue();
            return ({{classname}}.{{>request_builder_name_partial}}) this;
        }
        {{/isNullable}}{{/isNumber}}
        {{/optionalParamsWithRequestBodyProperties}}
        /**
         * Build call for {{operationId}}
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         {{#responses.0}}
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            {{#responses}}
            <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
            {{/responses}}
         </table>
         {{/responses.0}}
         {{#isDeprecated}}
         * @deprecated
         {{/isDeprecated}}
         */
        {{#isDeprecated}}
        @Deprecated
        {{/isDeprecated}}
        public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException {
            {{#bodyParams}}
            {{{dataType}}} {{paramName}} = buildBodyParams();
            {{/bodyParams}}
            return {{operationId}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback);
        }

        {{#bodyParams}}
        private {{{dataType}}} buildBodyParams() {
            {{^isStrictlyObject}}
            return this.{{paramName}};
            {{/isStrictlyObject}}
            {{#isStrictlyObject}}
            {{{dataType}}} {{paramName}} = new {{{dataTypeClass}}}();
            {{#vars}}
            {{#isEnum}}
            if (this.{{name}} != null)
            {{/isEnum}}
            {{#isHashMap}}
            {{paramName}}.put("{{name}}", {{> build_body_param_setter_partial}});
            {{/isHashMap}}
            {{^isHashMap}}
            {{paramName}}.{{name}}({{> build_body_param_setter_partial}});
            {{/isHashMap}}
            {{/vars}}
            return {{paramName}};
            {{/isStrictlyObject}}
        }
        {{/bodyParams}}

        /**
         * Execute {{operationId}} request{{#returnType}}
         * @return {{.}}{{/returnType}}
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         {{#responses.0}}
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            {{#responses}}
            <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
            {{/responses}}
         </table>
         {{/responses.0}}
         {{#isDeprecated}}
         * @deprecated
         {{/isDeprecated}}
         */
        {{#isDeprecated}}
        @Deprecated
        {{/isDeprecated}}
        {{^vendorExtensions.x-streaming}}
        public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException {
            {{#bodyParams}}
            {{{dataType}}} {{paramName}} = buildBodyParams();
            {{/bodyParams}}
            {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
            return localVarResp.getResponseBody();{{/returnType}}
        }
        {{/vendorExtensions.x-streaming}}
        {{#vendorExtensions.x-streaming}}
        public InputStream execute() throws ApiException {
            return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
        }
        {{/vendorExtensions.x-streaming}}

        /**
         * Execute {{operationId}} request with HTTP info returned
         * @return ApiResponse&lt;{{returnType}}{{^returnType}}Void{{/returnType}}&gt;
         * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
         {{#responses.0}}
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            {{#responses}}
            <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
            {{/responses}}
         </table>
         {{/responses.0}}
         {{#isDeprecated}}
         * @deprecated
         {{/isDeprecated}}
         */
        {{#isDeprecated}}
        @Deprecated
        {{/isDeprecated}}
        {{^vendorExtensions.x-streaming}}
        public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException {
            {{#bodyParams}}
            {{{dataType}}} {{paramName}} = buildBodyParams();
            {{/bodyParams}}
            return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
        }
        {{/vendorExtensions.x-streaming}}
        {{#vendorExtensions.x-streaming}}
        public InputStream executeWithHttpInfo() throws ApiException {
            {{#bodyParams}}
            {{{dataType}}} {{paramName}} = buildBodyParams();
            {{/bodyParams}}
            return {{operationId}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
        }
        {{/vendorExtensions.x-streaming}}

        /**
         * Execute {{operationId}} request (asynchronously)
         * @param _callback The callback to be executed when the API call finishes
         * @return The request call
         * @throws ApiException If fail to process the API call, e.g. serializing the request body object
         {{#responses.0}}
         * @http.response.details
         <table summary="Response Details" border="1">
            <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
            {{#responses}}
            <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
            {{/responses}}
         </table>
         {{/responses.0}}
         {{#isDeprecated}}
         * @deprecated
         {{/isDeprecated}}
         */
        {{#isDeprecated}}
        @Deprecated
        {{/isDeprecated}}
        public okhttp3.Call executeAsync(final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException {
            {{#bodyParams}}
            {{{dataType}}} {{paramName}} = buildBodyParams();
            {{/bodyParams}}
            return {{operationId}}Async({{#allParams}}{{paramName}}, {{/allParams}}_callback);
        }
    }

    /**
     * {{summary}}
     * {{notes}}{{#requiredParams}}
     * @param {{paramName}} {{description}} (required){{/requiredParams}}
     * @return {{> request_builder_name_partial}}
     {{#responses.0}}
     * @http.response.details
     <table summary="Response Details" border="1">
        <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
        {{#responses}}
        <tr><td> {{code}} </td><td> {{message}} </td><td> {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} </td></tr>
        {{/responses}}
     </table>
     {{/responses.0}}
     {{#isDeprecated}}
     * @deprecated
     {{/isDeprecated}}
        {{#externalDocs}}
     * {{description}}
     * @see <a href="{{url}}">{{summary}} Documentation</a>
        {{/externalDocs}}
     */
    {{#isDeprecated}}
    @Deprecated
    {{/isDeprecated}}
    public {{classname}}.{{> request_builder_name_partial}} {{operationId}}({{#requiredParamsWithRequestBodyProperties}}{{#isNumber}}{{{dataTypeLowerCase}}}{{/isNumber}}{{^isNumber}}{{{dataType}}}{{/isNumber}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParamsWithRequestBodyProperties}}) throws IllegalArgumentException {
        {{#requiredParamsWithRequestBodyProperties}}
        {{^isNullable}}{{^isNumber}}if ({{paramName}} == null) throw new IllegalArgumentException("\"{{paramName}}\" is required but got null");{{/isNumber}}{{/isNullable}}
        {{#isString}}
        {{> min_length_validation_partial_param}}
        {{/isString}}
        {{/requiredParamsWithRequestBodyProperties}}
        return (({{classname}}) this).new {{> request_builder_name_partial}}({{#requiredParamsWithRequestBodyProperties}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParamsWithRequestBodyProperties}});
    }
    {{/vendorExtensions.x-group-parameters}}
    {{/operation}}
}
{{/operations}}
